<template>
  <div class="avue-sidebar">
    <!--<logo></logo>-->
    <el-scrollbar style="height:100%">
      <div class="avue-breadcrumb" style="text-align: center;border-bottom: 1px solid rgba(255,255,255,0.5)"
           v-if="showCollapse">
        <i class="icon-navicon avue-breadcrumb_collapse" style="font-size: 30px!important;color:#fff"
           :class="[{ 'avue-breadcrumb_collapse--right': isCollapse }]" @click="setCollapse"></i>
      </div>
      <!--<div v-if="validatenull(menu)"
           class="avue-sidebar&#45;&#45;tip">{{$t('menuTip')}}
      </div>-->
      <el-menu unique-opened
               :default-active="nowTagValue"
               mode="vertical"
               background-color="#333"
               text-color="#FAFAFA"
               :show-timeout="200"
               :collapse="keyCollapse">
        <sidebar-item :menu="menu" :screen="screen" first
                      :props="website.menu.props"
                      :collapse="keyCollapse"/>
      </el-menu>
    </el-scrollbar>
  </div>
</template>

<script>
import {mapState, mapGetters} from "vuex";
import logo from "../logo";
import sidebarItem from "./sidebarItem";

export default {
  name: "sidebar",
  components: {sidebarItem, logo},
  inject: ["index"],
  data() {
    return {};
  },
  created() {
    this.index.openMenu(this.menuId);
  },
  computed: {
    ...mapState({
      showCollapse: state => state.common.showCollapse,
    }),
    ...mapGetters(["website", "menu", "tag", "keyCollapse", "screen", "topMenuIndex", "isCollapse"]),
    nowTagValue: function () {
      return this.$router.$avueRouter.getValue(this.$route);
    }
  },
  mounted() {
  },
  methods: {
    setCollapse() {
      this.$store.commit("SET_COLLAPSE");
    },
  }
}
</script>
<style lang="scss" scoped>

/deep/ .el-scrollbar__wrap {
  overflow-x: hidden;
}

/deep/ .el-submenu__title {
  width: 200px;
}

</style>

